---
- name: "Update the apt package"
  apt:
    name: "*"
    state: "present"
    update_cache: yes
    force_apt_get: yes

- name: "Install packages for apt add repo over https"
  ansible.builtin.apt:
    name: "{{ apt_install_packages }}"
    state: "present"
    update_cache: yes
    force_apt_get: yes

- name: "Add key from official docker repo"
  ansible.builtin.apt_key:
    url: "{{ docker_gpg_key }}"
    state: "present"

- name: "Add docker repo"
  ansible.builtin.apt_repository:
    repo: "{{ docker_apt_repo }}"
    state: "present"

- name: "Update the apt package"
  ansible.builtin.apt:
    name: "*"
    state: "present"
    update_cache: yes
    force_apt_get: yes

- name: "Install docker-ce"
  ansible.builtin.apt:
    name: "docker-ce "
    state: "present"

- name: "Statred and Enabled docker"
  ansible.builtin.systemd:
    name: "docker.service"
    state: "started"
    enabled: true